﻿@layout BlankLayout;
@page "/mock"
@using System.Reflection
@using AntDesign.Docs.Services

<div id="@DemoId">
    @ShowCaseContent
</div>

@inject DemoService demoService

@code
{
    [Parameter]
    public string DemoId { get; set; }

    [Parameter]
    public string Type { get; set; }

    [Parameter(CaptureUnmatchedValues = true)]
    public IDictionary<string,object> Attributes { get; set; }

    RenderFragment ShowCaseContent => (builder) =>
    {
        var assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
        var showCase = System.Type.GetType($"{assemblyName}.{Type}");
        builder.OpenComponent(0, showCase);
        builder.CloseComponent();
    };
}
